package com.framework.loippi.utils;

import com.framework.loippi.controller.StateResult;

import java.util.List;

public class Validation {

	/**
	 * 参数必填
	 * 
	 * @param name
	 * @param value
	 */
	public static void require(String name, Object value) {
		if (value == null) {
			StateResult.prompt(APIXerror.NOT_NULL, name + "不能为空");
		}
	}

	/**
	 * 参数必填
	 * 
	 * @param value
	 */
	public static void require(Object value) {
		if (value == null) {
			StateResult.prompt(APIXerror.NOT_NULL, "参数不能为空");
		}
	}

	public static void min(List<?> list, int size) {
		if (list == null || list.size() < size) {
			StateResult.prompt(APIXerror.SIZE_TOO_MIN, "参数长度不能小于" + size);
		}
	}

}
